using System.ComponentModel;

namespace Xliff.Ui.Model
{
    public abstract class EntityBase : INotifyPropertyChanged
    {
        public bool IsDirty { get; private set; }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        protected void NotifyPropertyChanged(string propertyName)
        {
            IsDirty = true;

            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public void MarkPersisted()
        {
            IsDirty = false;
        }
    }
}